<%@ Control Language="C#" ClassName="State_Parameters" Inherits="Dimok.Web.UI.TableControl" %>
<%@ Register Namespace="Dimok.Web.UI"  Assembly="Dimok.Web.UI" TagPrefix="OR"  %>
<%@ Register Namespace="Data.DataSources" Assembly="App_Code" TagPrefix="DS"  %>

<script runat="server">
	void aaa(){
		"".Substring(0, Math.Min("".Length, 30));
	}
</script>

<asp:UpdatePanel ID="pnlRebateOffers" UpdateMode="Always" runat="server">
	<ContentTemplate>
		<OR:GridViewEx ID="grv" runat="server" AutoGenerateColumns="False" DataSourceID="ds"
			ShowFooter="True" AllowSorting="True" BackColor="Window" CellPadding="0" EnableTheming="True"
			Font-Names="verdana" EnableViewState="False" DataKeyNames="StateID,StateParameterID,StateParameterValue"
			ViewNameUpdate="t_State_Parameters" ViewNameInsert="t_State_Parameters"
			>
			<Columns>

				<asp:TemplateField HeaderText="State" SortExpression="StateLong">
					<ItemTemplate><asp:Label Text='<%#Eval("StateLong") %>' runat="server" /></ItemTemplate>
					<EditItemTemplate>
						<asp:DropDownList ID="selStateID" DataSourceID="dsStates" DataTextField="NameLong" DataValueField="ID" runat="server"
								 SelectedValue='<%# Bind("StateID") %>'></asp:DropDownList>
					</EditItemTemplate>
					<FooterTemplate>
						<asp:DropDownList ID="StateID" DataSourceID="dsStates" DataTextField="NameLong" DataValueField="ID" runat="server"></asp:DropDownList>
					</FooterTemplate>
				</asp:TemplateField>

				<asp:TemplateField HeaderText="StateParameter" SortExpression="StateParameter">
					<ItemTemplate><asp:Label Text='<%#Eval("StateParameter") %>' runat="server" /></ItemTemplate>
					<EditItemTemplate>
						<asp:DropDownList ID="selStateParameterID" DataSourceID="dsStateParameters" DataTextField="Name" DataValueField="ID" runat="server"
								 SelectedValue='<%# Bind("StateParameterID") %>'></asp:DropDownList>
					</EditItemTemplate>
					<FooterTemplate>
						<asp:DropDownList ID="StateParameterID" DataSourceID="dsStateParameters" DataTextField="Name" DataValueField="ID" runat="server"></asp:DropDownList>
					</FooterTemplate>
				</asp:TemplateField>

				<asp:TemplateField HeaderText="StateParameterValue" SortExpression="StateParameterValue">
					<ItemTemplate><asp:Label Text='<%# Eval("StateParameterValue").ToString().Substring(0,Math.Min(Eval("StateParameterValue").ToString().Length,50)) %>' title='<%# Eval("StateParameterValue") %>' runat="server" /></ItemTemplate>
					<EditItemTemplate><asp:TextBox TextMode="MultiLine" ID="txtStateParameterValue" Text='<%# Bind("StateParameterValue") %>' runat="server" /></EditItemTemplate>
					<FooterTemplate><asp:TextBox ID="StateParameterValue" Text='<%# Bind("StateParameterValue") %>' runat="server" /></FooterTemplate>
				</asp:TemplateField>

				<asp:TemplateField HeaderText="Description" SortExpression="StateParameterDescription">
					<ItemTemplate><asp:Label Text='<%#Eval("StateParameterDescription") %>' runat="server" /></ItemTemplate>
					<EditItemTemplate><asp:Label Text='<%# Eval("StateParameterDescription") %>' runat="server" /></EditItemTemplate>
				</asp:TemplateField>

			</Columns>
		</OR:GridViewEx>
	</ContentTemplate>
</asp:UpdatePanel>
<DS:State_ParametersDataSource ID="ds" runat="server"></DS:State_ParametersDataSource>

<DS:StatesDataSource ID="dsStates" runat="server"></DS:StatesDataSource>

<DS:StateParametersDataSource ID="dsStateParameters" runat="server"></DS:StateParametersDataSource>